

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">

                    <div class="layui-form" wid100="" lay-filter="">
                        <input type="hidden" value="{$adsInfo.uid}" name="uid">
                        <div class="layui-form-item">
                            <div class="layui-input-block choice_type">
                                <input type="radio" name="type" value="0" lay-filter="choice_type" title="永久禁言" {if $adsInfo.status == 0}checked{/if}>
                                <input type="radio" name="type" value="1" lay-filter="choice_type" title="临时禁言" {if $adsInfo.status == 1}checked{/if}>
                            </div>
                        </div>
                        <div class="layui-form-item show_time">
                            <div class="layui-input-block">
                                <input type="text" name="time" value="{$adsInfo.time??''}" id="start_time_input" class="layui-input" lay-verify="" placeholder="请选择时间">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <textarea name="admin_note"   value="{$adsInfo.admin_note}"   placeholder="请输入"  lay-verType="tips" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block text-center">
                                <button class="layui-btn" lay-submit="" lay-filter="ads-add">确认提交</button>
                                <button class="layui-btn layui-btn-primary" id="close">取消</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.min.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'admin', 'chat','laydate'], function() {
        var $ = layui.$
            ,form = layui.form
            ,laydate = layui.laydate
            ,admin = layui.admin;
        var index = parent.layer.getFrameIndex(window.name);

        if ('{$adsInfo.status}' == '1') {
            $('.show_time').show();
        } else {
            $('.show_time').hide();
        }

        laydate.render({
            elem: '#start_time_input',
            type: 'date',
            format: 'yyyy-MM-dd 00:00:00'
        });

        form.on('radio(choice_type)', function(obj){
            let v = $(this).val();
            if (v == 1) {
                $('.show_time').show();
            } else {
                $('.show_time').hide();
            }
            return false;
        });

        $('#close').on("click",function () {
            parent.layer.close(index);
        });

        form.on('submit(ads-add)', function(obj){
            //提交
            admin.req({
                url: '/admin/chat/appedit_post'
                ,data: obj.field
                ,success: function(res){
                    if (res.code == 0){
                        parent.layer.close(index);
                        parent.layer.msg(res.msg, {icon: 1});
                        parent.window.location.reload();
                    }
                }
            });
            parent.layer.close(index);
            return false;
        });
    });
</script>
</body>
</html>
